import {
	newRecordOptions
} from './js/myCharts'

export default {
	name: 'detail',
	data() {
		return {
			imgList: [{
				id: 0,
				icon: require('@/assets/images/search.png'),
				iconActive: require('@/assets/images/search-active.png')
			}, {
				id: 1,
				icon: require('@/assets/images/import.png'),
				iconActive: require('@/assets/images/import-active.png')
			}, {
				id: 2,
				icon: require('@/assets/images/export.png'),
				iconActive: require('@/assets/images/export-active.png')
			}, {
				id: 3,
				icon: require('@/assets/images/statistics.png'),
				iconActive: require('@/assets/images/statistics-active.png')
			}, {
				id: 4,
				icon: require('@/assets/images/delete.png'),
				iconActive: require('@/assets/images/delete-active.png')
			}],
			navList: [{
				id: 5,
				name: '全部'
			}, ],
			hoverIndex: -1,
			//点击获取某行数据
			rowValue: {
				supplier: '',
				address: '',
				contactInformation: '',
				myAsset: '',
				enclosure: '',
				owner: '',
				creater: '',
				createtime: '',
				updateTime: ''
			},
			tableData1: [{
				supplier: '重庆万化有限公司',
				address: '重庆市渝北区青峰北路',
				contactInformation: '18725691802',
				myAsset: '',
				enclosure: '',
				owner: '刘华强',
				creater: '刘华强',
				createtime: '2019/09/23 10:20',
				updateTime: '2019/09/23 10:20'
			}, {
				supplier: '重庆泽鑫有限公司',
				address: '重庆市巴南区鱼洞镇鱼轻路２７号',
				contactInformation: '15925691362',
				myAsset: '',
				enclosure: '',
				owner: '张天华',
				creater: '张天华',
				createtime: '2019/09/25 16:23',
				updateTime: '2019/09/25 16:23'
			}],
			tableData2: [
			{
				supplier: '重庆敖雄有限公司',
				address: '重庆市渝北区大竹林街道',
				contactInformation: '18765421694',
				myAsset: '',
				enclosure: '',
				owner: '张强',
				creater: '张强',
				createtime: '2019/08/23 09:45',
				updateTime: '2019/08/23 09:45'
			}, 
			{
				supplier: '重庆万化有限公司',
				address: '重庆市渝北区青峰北路',
				contactInformation: '18725691802',
				myAsset: '',
				enclosure: '',
				owner: '刘华强',
				creater: '刘华强',
				createtime: '2019/09/23 10:20',
				updateTime: '2019/09/23 10:20'
			}, 
			{
				supplier: '重庆泽鑫有限公司',
				address: '重庆市巴南区鱼洞镇鱼轻路２７号',
				contactInformation: '15925691362',
				myAsset: '',
				enclosure: '',
				owner: '张天华',
				creater: '张天华',
				createtime: '2019/09/25 16:23',
				updateTime: '2019/09/25 16:23'
			}],
			drawer: false, // 统计抽屉,
			exportDialogVisible: false, //导出Excel弹框是否显示
			uploadDialogVisible: false, //上传Excel弹框是否显示
			detailDialogVisible: false, //详情弹框是否显示
			createDialogVisible: false, //新增资产弹框是否显示
			//选中导出字段
			checked: ["供应商名称", "供应商地址", "联系方式", "拥有者", "创建人", "创建时间", "最后修改时间"],
			//全部导出字段
			checkList: ["供应商名称", "供应商地址", "联系方式", "拥有者", "创建人", "创建时间", "最后修改时间"],
			//是否全选
			checkAll: false,
			//全选
			isIndeterminate: false,
			//变动记录
			change: [],
			//其他
			statistics: [],
			//详情弹框里的详情头部
			titles: ["名称", "品牌", "保修时间"],
			//记录内容
			lines: [
				{name:"信息化管理",brand:"联想",year:"5年"},
				{name:"MD-NT-110",brand:"联想",year:"8年"},
				{name:"ZC2019000009",brand:"联想",year:"7年"},
				{name:"IN-MD-005",brand:"微软",year:"10年"},
				{name:"IN-MD-006",brand:"微软",year:"10年"},
				{name:"IN-MD-007",brand:"微软",year:"10年"},
			],
			//新增资产
			newAsset: {
				supplier: '',
				address: '',
				contactInformation: '',
				myAsset: '',
				enclosure: '',
				owner: '',
				creater: '',
				createtime: '',
				updateTime: ''
			},
			//是否保存后新增下一条
			checked: false,
		}
	},
	mounted() {},
	methods: {
		/**
		 * 鼠标移出
		 * @param index
		 */
		mouseLeave: function(index) {
			this.hoverIndex = index
		},
		/**
		 * 鼠标移入
		 * @param index
		 */
		mouseEnter: function(index) {
			this.hoverIndex = index
		},
		/*点击图标弹出相应的弹框*/
		iconClick(id) {
			if (id === 3) {
				this.drawer = true
			} else if (id === 1) {
				this.uploadDialogVisible = true
			} else if (id === 2) {
				this.exportDialogVisible = true
			} else if (id === 4) {
				this.$confirm('您确定要删除这条记录?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					
					this.tableData1.splice(0, 1);
					
					this.$message({
						type: 'success',
						message: '删除成功!'
					});
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消删除'
					});
				});
			}
		},
		//导出全选
		handleCheckAllChange(val) {
			this.checked = val ? this.checkList : [];
			this.isIndeterminate = false;
		},
		handleCheckedCitiesChange(value) {
			let checkedCount = value.length;
			this.checkAll = checkedCount === this.checkList.length;
			this.isIndeterminate = checkedCount > 0 && checkedCount < this.checkList.length;
		},
		//点击某行数据
		handleRow(val) {
			this.rowValue = val;
			console.log(this.rowValue);
			this.detailDialogVisible=true;
		},
		/*导入文件*/
		uploadExcel() {
			this.tableData1=this.tableData2;
			this.uploadDialogVisible = false;
		},
		//新增资产
		creatAsset(){
			this.createDialogVisible=true;
		},
	}
}